<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Practical 2</title>
    </head>
    <body>

        <table>  
            <?php
            // Opens the PHP tag.
            // Starts the table that will hold all of our results.
            echo "<tr>\n";                                              // Makes the first row.
            $multiplyBy         = 1;                                	// How much to times by - 1*2, 2*2, 3*2, 4*2 and so on.
            $curentTimesTable   = 1;                                	// The times table we are doing - 2 times table, 3 times table... 12 times
            while ($multiplyBy <= 12 && $curentTimesTable <= 12) {      // A loop that makes sure that the grid is 12x12.
                $answer = $multiplyBy * $curentTimesTable;              // Calculating the current answer.
                echo "<td>$answer</td>\n";                              // Making a new cell to hold the result, as well as putting the result in.
                $a++;                                                   // Adds one to the $a variable. 
                if ($a == 11) {                                         // Sees if $a has reached 11 yet, if it has it does a number of things.
                    echo "</tr>\n";                                     // Ends that row.
                    if ($b < 12)                                        // Checks if our times table is still less than 12.
                        echo "<tr>\n";                                  // If it is then it makes a new row.
                    $multiplyBy     = 1;                                // Resets $a back to 1 so we can do the next row of calculations.
                    $curentTimesTable++;                                // Adds one to the times table we are doing.
                }                                                       // Closes our check for $a equalling 11.
            }                                                           // Ends the while loop and stops the calculations being done.
            
            ?>  
        </table>                                        

        <?php
            echo "<br/><br/>Test Message Should be displaying!";
            ?>

    </body>
</html>
